package com.luyu.controller;


import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.luyu.entity.Product;
import com.luyu.res.ResultRes;
import com.luyu.service.IProductService;
import jakarta.annotation.Resource;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

/**
 * <p>
 *  前端控制器
 * </p>
 *
 * @author author
 * @since 2024-10-18
 */
@RestController
@RequestMapping("/product/{tenantId}")
public class ProductController {

    @Resource
    private IProductService productService;


    @GetMapping
    @PreAuthorize("@rbac.hasPermission('query',true)")
    public ResultRes<List<Product>> sendConfirm(@PathVariable("tenantId") Long tenantId) {
        Page<Product> page = productService.page(new Page<>());
        return ResultRes.success(page.getRecords());
    }

}
